<?php

namespace App\Http\Controllers\Main;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Cache;
use App\Models\Category;
use App\Http\Lib\HttpClient;


class IndexController extends Controller
{
    # 首页
    public function index(Request $request)
    {
        return view('index');
    }

    # 测试
    public function test(Request $request)
    {
        Cache::flush();
        // Cache::put('key', ['name'=>'tony', 'age'=>25, 'info'=>'中国'], 60);
        // return Cache::get('key');
        return $request->route()->getName();
    }


    # 被其他应用代理调用的接口
    public function test1(Request $request)
    {
        return $this->o('you got it');
    }

    # 代理调用b应用的a接口
    public function api_a(Request $request)
    {
        $data = ['keyword' => $request->keyword];
        return $this->privateApi('GET', 'http://b.domain.com/api/a', $data, true);
    }

}
